Skip to content

Conversation

@florentchauveau
Copy link
Contributor

Fixes #17

Parameters should be unscaped before being sent for validation.

gorillamux returns escaped parameters, but openapi3filter expects unescaped parameters.

Parameters should be unscaped before being sent for validation.
gorillamux returns escaped parameters, but openapi3filter expects
unescaped parameters.
@florentchauveau
Copy link
Contributor Author

Hello @jamietanna, any chance we can get this merged? I just rebased the branch on main.

Let me know if I need to change anything.

return http.StatusMethodNotAllowed when appropriate
mromaszewicz pushed a commit to mromaszewicz/echo-middleware that referenced this pull request Feb 7, 2026
gorillamux uses UseEncodedPath(), so FindRoute() returns path parameters
in percent-encoded form. openapi3filter expects decoded values, which
causes validation of constraints like maxLength and pattern to fail on
encoded input (e.g. %2B is 3 chars but decodes to 1 char).

Unescape path parameters after route matching and before passing them
to openapi3filter.

Fixes oapi-codegen#17
Supersedes oapi-codegen#18

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mromaszewicz pushed a commit to mromaszewicz/echo-middleware that referenced this pull request Feb 7, 2026
gorillamux uses UseEncodedPath(), so FindRoute() returns path parameters
in percent-encoded form. openapi3filter expects decoded values, which
causes validation of constraints like maxLength and pattern to fail on
encoded input (e.g. %2B is 3 chars but decodes to 1 char).

Unescape path parameters after route matching and before passing them
to openapi3filter.

Fixes oapi-codegen#17
Supersedes oapi-codegen#18

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mromaszewicz added a commit that referenced this pull request Feb 7, 2026
gorillamux uses UseEncodedPath(), so FindRoute() returns path parameters
in percent-encoded form. openapi3filter expects decoded values, which
causes validation of constraints like maxLength and pattern to fail on
encoded input (e.g. %2B is 3 chars but decodes to 1 char).

Unescape path parameters after route matching and before passing them
to openapi3filter.

Fixes #17
Supersedes #18

Co-authored-by: Florent CHAUVEAU <florentch@pm.me>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@mromaszewicz
Copy link
Member

I've cherry picked your change into a different PR, due to the age of this PR, and also added more thorough testing. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Path parameters are not validated properly when they are encoded

2 participants